#ifndef __PUBLIC_H__
#define __PUBLIC_H__

#define ERR_FLAG(info) do{printf("%s:%s:%d>>%s\n",__FILE__,__func__,__LINE__,info);}while(0)

/*
typedef struct{
//    char head;
	char cmd;
//	char resever;
	char identity;
    char err_num;
//	union{
		staff_info_TypeDef staff_info;
		login_info_TypeDef login_info;
//	};
	char check;
}Staff_Data_TypeDef;
*/
#define NAME_MAX 20
#define PWD_MAX 20
#define PHONE_MAX 15
#define ADDR_MAX 128
#define TIME_MAX 12
#define JOB_MAX 32
#define STATE_MAX 8
#define USERMODE_COMMON  1 //普通用户
#define USERMODE_ADMIN   0 //管理员用户

#define CMD_LOGIN		 0x10
#define CMD_ADD_STAFF    0x20
#define CMD_DEL_STAFF    0x30
#define CMD_FIND_ID      0x50
#define CMD_FIND_NAME    0x51
#define CMD_FIND_ALL     0x60
#define CMD_FIND_HISTORY 0x70
#define CMD_MODIFY_NAME  0x40
#define CMD_MODIFY_AGE   0x41
#define CMD_MODIFY_ADDR  0x42
#define CMD_MODIFY_PHONE 0x43
#define CMD_MODIFY_JOB   0x44
#define CMD_MODIFY_SALARY 0x45
#define CMD_MODIFY_TIME  0x46
#define CMD_MODIFY_STATE 0x47
#define CMD_MODIFY_NPWD  0x48

typedef struct{
	int 	id;
	int	    mode;
	char 	name[20];	
	char 	pwd[20];
	int 	age;
	char 	phone[15];
	char 	addr[128];
	char 	job[32];
	char 	time[12];	//2015.10.23
	char 	state[8];	//T1~T10
	int		salary;		
}staff_info_TypeDef;

// typedef struct{
// 	char name[20];
// 	char pwd[20];
// }login_info_TypeDef;

typedef struct{
	char cmd;
    char data[256];
	int  imode;
	staff_info_TypeDef staff_info;
	char history[256];
}Staff_Data_TypeDef;

#endif
